<?php get_header(); ?>
	<div id="container">
		<div id="content">

<?php while (have_posts()) : the_post(); ?>
			<div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class() ?>">

<?php
	$options=get_option('dkret3');
	if( (in_category( $options['gallery_cat_id'] )) && (($options['showgallery']) == '1') ) {
?>
				<div class="entry-gallery">
					<div class="entry-gallery-image">
						<a href="<?php permalink_link() ?>"><?php $hilite = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment' LIMIT 1" ); echo wp_get_attachment_image( $hilite, 'thumbnail' ); ?></a>
						<p><?php printf(__('This album contains <strong>%s</strong> items.', 'dkret'), $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment'" ) ) ?></p>
					</div><!-- .entry-gallery-image -->
					<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'dkret'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title(); ?></a></h2>

					<div class="entry-gallery-description">
						<?php the_excerpt(''); ?>
					</div><!-- .entry-gallery.description -->

<?php edit_post_link(__('Edit', 'dkret'), "\t\t\t\t\t<span class=\"edit-link\">", "</span>\n"); ?>					

				</div><!-- .entry-gallery -->

<?php } else { // If it's a regular post or a permalink page ?>

				<div class="entry-header">
					<div class="entry-calendar-date">
						<?php the_time('M') ?>

						<span class="entry-calendar-day"><?php the_time('d') ?></span>
						<span class="entry-calendar-year"><?php the_time('Y') ?></span>
					</div><!-- .entry-calendar-date -->
					<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'dkret'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title(); ?></a></h2>
					<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s &#8211; %2$s', 'dkret'), the_date('', '', '', false), get_the_time()) ?></abbr></div>
					<div class="entry-meta-above">
						<span class="author vcard"><?php printf(__('By %s', 'dkret'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'dkret'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
						<span class="meta-sep">|</span>
						<span class="cat-links"><?php printf(__('Posted in %s', 'dkret'), get_the_category_list(', ')) ?></span>
						<span class="meta-sep">|</span>
						<?php the_tags(__('<span class="tag-links">Tagged ', 'dkret'), ", ", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n") ?>
<?php edit_post_link(__('Edit', 'dkret'), "\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n"); ?>
						<span class="comments-link"><?php comments_popup_link(__('Comments (0)','dkret'), __('Comments (1)','dkret'), __('Comments (%)','dkret'),'', __('Comments off','dkret') ); ?></span>
					</div><!-- .entry-meta-above -->
				</div><!-- .entry-header -->

				<div class="entry-content">
<?php the_content(''.__('Read More <span class="meta-nav">&raquo;</span>', 'dkret').''); ?>

					<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'dkret') . '&after=</div>') ?>
				</div><!-- .entry-content -->

				<div class="entry-meta">
					<span class="author vcard"><?php printf(__('By %s', 'dkret'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'dkret'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
					<span class="meta-sep">|</span>
					<span class="cat-links"><?php printf(__('Posted in %s', 'dkret'), get_the_category_list(', ')) ?></span>
					<span class="meta-sep">|</span>
					<?php the_tags(__('<span class="tag-links">Tagged ', 'dkret'), ", ", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n") ?>
					<span class="comments-link"><?php comments_popup_link(__('Comments (0)','dkret'), __('Comments (1)','dkret'), __('Comments (%)','dkret'),'', __('Comments off','dkret') ); ?></span>
				</div>

<?php edit_post_link(__('Edit', 'dkret'), "\t\t\t\t<span class=\"edit-link\">", "</span>\n"); ?>
<?php } ?>
			</div><!-- #post-??ID -->
<?php comments_template() ?>


<?php endwhile ?>

			<div id="nav-below" class="navigation">
				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'dkret')) ?></div>
				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'dkret')) ?></div>
			</div><!-- #nav-below .navigation -->

		</div><!-- #content -->
	</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>